<template>
    <div class="u-p-20">
        <el-card shadow="never">
            <div slot="header">
                <span>
                    <b class="u-f-16">物流列表</b>
                </span>

                <router-link :to="{name:'logisticsEdit'}" v-if="hasPerm('logisticsEdit')">
                    <el-button type="danger" size="small" icon="el-icon-plus" class="u-right u-5mt" round>添加物流</el-button>
                </router-link>

                <el-button type="success" size="small" icon="el-icon-download" class="u-right u-5mt" round @click="loads" >下载表格</el-button>
            </div>

            <el-form :inline="true" :model="queryForm" size="small" class="u-text-center">

                <el-form-item label="物流名称">
                    <el-input v-model="queryForm.keyword" placeholder="物流名称" clearable></el-input>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" icon="el-icon-search" @click="getPageData(true)">查询</el-button>
                </el-form-item>

            </el-form>

            <el-table :data="tableData" class="u-mt-10" v-viewer>
                <el-table-column label="id" prop="id" width="100"></el-table-column>

                <el-table-column label="物流名称" prop="logistics_name"></el-table-column>
                <el-table-column label="物流编码" prop="logistics_code" sortable></el-table-column>
                <el-table-column label="操作" width="120">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRoute(scope.row.id,'logisticsEdit')" v-if="hasPerm('logisticsEdit')">编辑</el-button>
                        <el-button size="mini" type="text" @click="handleDelete(scope.row.id)" v-if="hasPerm('logisticsDelBtn')">删除</el-button>
                    </template>
                </el-table-column>
                <!-- <el-table-column label="操作" width="120">
                    <template slot-scope="scope" >
                        <el-dropdown v-if="!isprops">
                            <span class="el-dropdown-link">
                                操作<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item>
                                    <el-button size="mini" type="text" @click="handleRoute(scope.row.id,'logisticsEdit')"
                                        v-if="hasPerm('logisticsEdit')">编辑</el-button>
                                </el-dropdown-item>

                                <el-dropdown-item>
                                    <el-button size="mini" type="text" @click="handleDelete(scope.row.id)" v-if="hasPerm('logisticsDelBtn')">删除</el-button>
                                </el-dropdown-item>

                            </el-dropdown-menu>
                        </el-dropdown>

                        <el-button size="mini" type="text" v-else  @click="select_data(scope.row)">选择</el-button>
                    </template>



                </el-table-column> -->
            </el-table>

            <div class="u-mt-20 u-text-center">
                <el-pagination background @size-change="handleSizeChange" @current-change="handlePageChange"
                    :current-page="currentPage" :page-sizes="[10, 20, 30, 40, 50]" :page-size="limit" layout="total, sizes, prev, pager, next, jumper"
                    :total="total">
                </el-pagination>
            </div>
        </el-card>

    </div>



</template>

<script>
    import commonPage from '@/mixins/common-page'
    export default {
        mixins: [commonPage],
        props:{
            isprops:Boolean
        },
        data() {
            return {
                apiName: 'logistics',
                queryForm: {
                    keyword: ''
                },
                publicPath: process.env.BASE_URL,//url
            }
        },
        methods:{
          loads(){
              //下载表格
              window.location.href=this.publicPath+"static/2019code.xlsx";//下载表格
          },
          select_data(row){
              //选中数据
              this.$emit('get_select',row);//返回父组件
          }
        },
        created(){
            // window.console.log(isprops)
        }
    }
</script>
